package _4ChapterFore._5ReplaceNastedConditionalWithGuardClauses;

public class Main {
    private boolean isDead = false;
    private boolean isSeparated = true;
    private boolean isRetired = true;

    public boolean isDead() {
        return isDead;
    }

    public void setDead(boolean dead) {
        isDead = dead;
    }

    public boolean isSeparated() {
        return isSeparated;
    }

    public void setSeparated(boolean separated) {
        isSeparated = separated;
    }

    public boolean isRetired() {
        return isRetired;
    }

    public void setRetired(boolean retired) {
        isRetired = retired;
    }

    public double getPayAmountOld(){
        double result;
        if (isDead){
            result = deadAmount();
        }else if (isSeparated){
            result = separatedAmount();
        }else if (isRetired){
            result = retiredAmount();
        }else {
            result = normalPayAmount();
        }
        return result;
    }

    public double getPayAmountNew(){
        if (isDead){
            return deadAmount();
        }
        if (isRetired){
            return retiredAmount();
        }
        if (isSeparated){
            return separatedAmount();
        }
        return normalPayAmount();
    }



    private double deadAmount(){
        return 0.3;
    }

    private double separatedAmount(){
        return 0.9;
    }

    private double retiredAmount(){
        return 5.6;
    }

    private double normalPayAmount(){
        return 100.3;
    }
}
